package com.zl.service.impl;

import com.zl.dao.UserDao;
import com.zl.pojo.User;
import com.zl.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao ud;
    @Override
    public User login(User user) {
        if(user.getName()==null || "".equals(user.getName()) || user.getPwd()==null ||"".equals(user.getPwd())){
            user=null;
        }
        user=ud.login(user);
        return user;
    }

    @Override
    public int regName(String name) {
        int flag=ud.regName(name);
        return flag;
    }

    @Override
    public int regUser(User user) {
        int flag = ud.regUser(user);
        return flag;
    }

    @Override
    public User queryUserByName(String name) {
        User user = ud.queryUserByName(name);
        return user;
    }
}
